/**
 * @CopyRight weitaming.com
 * @author wuyahui
 * @E-mail wuyahui@ispied.com
 * @version 1.0.0
 * @Date  2014年5月6日 上午11:12:52
 */
package com.tstudy.laoshibang.manager;

import java.sql.SQLException;

import com.tstudy.laoshibang.db.DBManagerImpl;
import com.tstudy.laoshibang.mode.SearchHistory;

import android.annotation.SuppressLint;

public class SearchHistoryManager extends DBManagerImpl {
	private SearchHistoryManager() {
	}

	public static SearchHistoryManager instance = new SearchHistoryManager(SearchHistory.class);

	private SearchHistoryManager(Class<SearchHistory> clazz) {
		super(clazz);
	}

	public static SearchHistoryManager getInstance() {
		return instance;
	}
	
	@SuppressLint("DefaultLocale")
	public boolean clearByType(Class<?> clazz,String type){
		boolean result = false;
		try {
			int deleteCount = dao.executeRaw("delete from " + clazz.getSimpleName() + " where type = '" + type + "'");
			result = deleteCount > 0 ?true:false;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return result;
	}
	
}
